package com.design.pattern.singleton.register;import java.util.Map;import java.util.concurrent.ConcurrentHashMap;/** * create by yufeng on 2021/7/3 22:30 */public class ContainerSingleton {    private ContainerSingleton(){}    private static Map<String,Object> ioc = new ConcurrentHashMap<String, Object>();    public static Object getInstance(String className){        Object instance = null;        if(!ioc.containsKey(className)){            try {                instance = Class.forName(className).newInstance();                ioc.put(className, instance);            }catch (Exception e){                e.printStackTrace();            }            return instance;        }else{            return ioc.get(className);        }    }}